package team.cdlzz.model.servicePojo;

import lombok.Data;
import team.cdlzz.model.pojo.User;
import team.cdlzz.util.IDUtils;

import javax.annotation.Resource;

/**
 * @author zw
 * @date 2022-06-28.
 */
@Data
@Resource
public class SocketUser {
    String username;
    String userid;

    @Override
    public String toString() {
        return "SocketUser{" +
                "username='" + username + '\'' +
                ", userid='" + userid + '\'' +
                ", img='" + img + '\'' +
                ", role=" + role +
                '}';
    }

    String img;
    Integer role;

    public SocketUser() {
    }

    public SocketUser(User user) {
        username = user.getName();
        userid = IDUtils.generateUserId(user.getName());
        role = 0;
        img = IDUtils.getPath(user.getPhoto(),1);
    }
}